home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 021a / lcad37.zip / LC.LSP < prev    next >
Lisp/Scheme  |  1991-10-07  |  4KB  |  103 lines

  1.  
  2. ; LaunchCAD Autolisp program version 3.7
  3.  
  4. ; Note: add the line:     (load"lc")     to the end of your ACAD.LSP file.
  5. ; If you do not have an ACAD.LSP file then you can rename this file to ACAD.LSP
  6. ; or add the contents of this file to your present ACAD.LSP file.
  7.  
  8. (princ "\nLoading LaunchCAD...")
  9. (if(< (substr(getvar "ACADVER")1 2) "11")
  10.   (setvar "MENUECHO" 1))                        ; this makes INSERT work right
  11.  
  12. (defun lc_shell (mode dt / ce me dir f)         ; call LaunchCAD in shell mode
  13.   (setq ce (getvar "CMDECHO")
  14.     me (getvar "MENUECHO"))
  15.   (setvar "CMDECHO" 0)                          ; don't echo commands
  16.   (setvar "MENUECHO" 1)                         ; do echo menu commands
  17. ; (command "sh" "mode co80")                    ; decomment for dual screen
  18.   (if (= dt "d") (progn
  19.     (setq dir (getvar "DWGPREFIX"))
  20.     (command "launchcad" (strcat mode " " dir)) ; invoke LaunchCAD
  21.   ) ;else
  22.     (command "launchcad" mode)
  23.   )
  24. ; (command "sh" "mode mono")                    ; decomment for dual screen
  25. ; (graphscr)                    ;    "           "
  26.   (if(null(setq username (getenv "USERNAME")))
  27.     (setq username "LC"))
  28.   (command ".SCRIPT" username)                  ; run the script
  29.   (if (setq f (open(findfile (strcat username ".SCR")) "w"))
  30.     (setq f (close f)))                         ; just in case...
  31.   (setvar "CMDECHO" ce)                         ; restore CMDECHO
  32.   (setvar "MENUECHO" me)                        ; restore MENUECHO
  33.   (princ)
  34. )
  35.  
  36. ; Note: You may edit this lisp file to rename the following functions
  37. ; to any name that you wish so long as it does not conflict with an
  38. ; AutoCAD internal command.
  39.  
  40. ; Execute LaunchCAD from within AutoCAD (in shell mode)
  41.  
  42. (defun c:lc ()     (lc_shell "/s" "d"))       ; shell mode menu
  43. (defun c:lce ()  (lc_shell "/e" "d"))       ; end and select another
  44. (defun c:lcw ()  (lc_shell "/w" "d"))       ; wblock *;quit and select another
  45. (defun c:lcq ()  (lc_shell "/q" "d"))       ; quit and select another
  46. (defun c:ins ()  (lc_shell "/i" "s"))       ; Insert Mode
  47. (defun c:lisp () (lc_shell "/l" "s"))       ; Lisp Mode
  48. (defun c:dxf ()  (lc_shell "/d" "s"))       ; DXFIN Mode
  49. (defun c:dxb ()  (lc_shell "/b" "s"))       ; DXBIN Mode
  50. (defun c:vs ()     (lc_shell "/v" "s"))       ; VSlide Mode
  51. (defun c:mu ()     (lc_shell "/m" "s"))       ; Menu Mode
  52. (defun c:sty ()  (lc_shell "/t" "s"))       ; Style Mode
  53. (defun fi ()     (lc_shell "/f" "s"))       ; invoke LaunchCAD file Mode
  54.  
  55. ; Redefine the QUIT command to run quit.scr in order to
  56. ; bypass the AutoCAD opening menu.
  57.  
  58. (defun c:quit ()
  59.   (setvar "CMDECHO" 0)
  60.   (initget "No Yes")
  61.   (if(= "Yes" (getkword
  62.     "\nDo you really want to discard\nall changes to drawing[y/N]: "))
  63.     (command ".SCRIPT" "QUIT"))
  64.   (princ)
  65. )
  66.  
  67. ; Redefine the END command to run end.scr in order to
  68. ; bypass the AutoCAD opening menu.
  69.  
  70. (defun c:end ()
  71.   (setvar "CMDECHO" 0)
  72.   (command ".SCRIPT" "END")              ; run end.scr which bypasses menu
  73.   (princ)
  74. )
  75.  
  76. (defun c:wend ()
  77.   (setvar "CMDECHO" 0)
  78.   (command ".SCRIPT" "WEND")              ; run wend.scr which saves drawing
  79.   (princ)                 ; using wblock * and bypasses menu
  80. )
  81.  
  82. ; Undefine the AutoCAD drawing editor END and QUIT commands so that
  83. ; the end and quit functions defined above will work in place of the
  84. ; internal commands (.end and .quit will still work like normal)
  85. ; NOTE: (lc:su) MUST be in STARTUP.LSP or the S::STARTUP function
  86. ; in ACAD.LSP
  87.  
  88. (defun lc:su()
  89.   (command "UNDEFINE" "QUIT")
  90.   (command "UNDEFINE" "END")
  91.   (princ "\nEND and QUIT commands redefined...")
  92.   (if(null(setq username (getenv "USERNAME")))
  93.     (setq username "LC"))
  94.   (if (setq f (open(findfile (strcat username ".SCR")) "w"))
  95.     (setq f (close f)))             ; delete script file
  96.   (princ "\nLaunchCAD initialized.")
  97.   (princ)
  98. )
  99.  
  100. (princ "\nLaunchCAD version 3.7 ")
  101. (princ)
  102.  
  103.